#include "PwmManager.h"
#include "GPIOManager.h"

#include <unistd.h>

void pwmWrite(FILE* pinFile, int interval, int frequence)
{
	int i = 0;
	
	int period = (1.0 / frequence) * 1000000;
	
	for( i = 0; i < frequence; ++i )
	{
		pinWrite(pinFile, ON);
		usleep( interval );
		
		pinWrite(pinFile, OFF);
		usleep( period - interval );
	}
	
	sleep(0.5);
}
